﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EasyClassUI.entity {
    public class StudyGroup {
        public int StudyGroupID { get; set; }
        public string StudyGroupName { get; set; }
        public string Category { get; set; }
        public string Members { get; set; }//用来存放已经加入此小组的成员（将链表序列化成字符串存储）
        public User User { get; set; }
        public string Description { get; set; }//小组的描述
        public List<StudyResource> StudyResources { get; set; }
        public List<Post> Posts { get; set; }

        public string ExportCreateJson() {
            string json = "{\"StudyGroupName\":\"" + StudyGroupName + "\",\"Category\":\"" + Category + "\", \"Description\": \"" + Description + "\"}";
            return json;
        }

        public static bool isInGroupIjoined(int groupID) {
            foreach(StudyGroup group in GroupIJoined) {
                if (group.StudyGroupID == groupID) {
                    return true;
                }
            }
            return false;
        }

        public static StudyGroup[] GroupIJoined;
        public static List<StudyGroup> GroupICreated;
        public static bool LocalGroupDataGenerated = false;
    }
}
